package com.yf.tz.controller.api;

import com.yf.annotation.IgnoreAuth;
import com.yf.entity.TokenEntity;
import com.yf.response.R;
import com.yf.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;

@RequestMapping("/api/login")
public class ApiLoginController {

    @Autowired
    private TokenService tokenService;

    @PostMapping("/test")
    @IgnoreAuth
    public R test(Long userId){
       TokenEntity tokenEntity = tokenService.createToken(userId);
        return R.ok(tokenEntity.getToken());
    }

}
